package com.oa.tools.listeners;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import com.oa.tools.jobs.DynamicJob;

@Component
public class InitListener implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
    	DynamicJob job = contextRefreshedEvent.getApplicationContext().getBean(DynamicJob.class);
        job.startCron();
    }
}